<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>合同产品</title>
<%@include file="/skins/jsp/loadCss.jsp"%>
<style>
.ch-g1-2,.ch-g1-4 {
	display: inline-block;
	vertical-align: top;
}

.ch-g1-2 {
	width: 49%;
}

.ch-g1-4 {
	width: 24%;
}
</style>
</head>
<body>
	<h1>合同产品</h1>
	<p class="ch-form-actions" style="float: right;margin-bottom: 5px;"><s:a cssClass="ch-btn ch-btn-small" action="findContracts"
					namespace="/contract">后退</s:a></p>
	<table class="ch-datagrid">
		<thead>
			<tr>
				<th align="center" width="4%">序号</th>
				<th width="10%">产品名称</th>
				<th width="10%">产品订货号</th>
				<th width="10%">品牌</th>
				<th width="10%">型号</th>
				<th width="10%">数量</th>
				<th width="10%">单价</th>
				<th width="10%">总价</th>
				<th width="10%">操作</th>
			</tr>
		</thead>
		<tbody>
			<s:iterator value="cgList" status="st">
				<tr <s:if test="#st.isEven()">style="BACKGROUND: #f8f8f8"</s:if>>
					<td align="center"><s:property value="%{#st.count}" /></td>
					<td><s:property value="cgName" />
					</td>
					<td><s:property value="cgOrder" /></td>
					<td><s:property value="cgBrand" /></td>
					<td><s:property value="cgMode" /></td>
					<td align="center"><s:property value="cgNum" /></td>
					<td align="center"><s:property value="cgPrice" /></td>
					<td align="center"><s:property value="cgAmount" /></td>
					<td>
						<i class="ch-icon-remove" style="cursor: pointer;" onclick="delCue('<s:property value="cttId" />','<s:property value="cgId" />')" title="删除产品"></i>
					</td>
				</tr>
			</s:iterator>
		</tbody>
	</table>
	<div class="ch-box" style="margin-top: 10px;">
		<h2>添加合同中产品清单</h2>
		<s:form action="saveCGood" namespace="/contract" method="POST">
			<s:hidden name="cttId"></s:hidden>
			<div class="ch-g1-2">
				<p class="ch-form-row">
					<label for="cgName">产品名称: </label> <s:textfield id="cgName" name="cgName" size="30"></s:textfield>
				</p>
				<p class="ch-form-row">
					<label for="cgBrand">品牌: </label> <s:textfield id="cgBrand" name="cgBrand" size="30"></s:textfield>
				</p>
				<p class="ch-form-row">
					<label for="cgNum">数量: </label> <s:textfield id="cgNum" name="cgNum" size="30"></s:textfield>
				</p>
			</div>
			<div class="ch-g1-2">
				<p class="ch-form-row">
					<label for="cgOrder">产品订货号: </label> <s:textfield id="cgOrder" name="cgOrder" size="30"></s:textfield>
				</p>
				<p class="ch-form-row">
					<label for="cgMode">型号: </label> <s:textfield id="cgMode" name="cgMode" size="30"></s:textfield>
				</p>
				<p class="ch-form-row">
					<label for="cgPrice">单价: </label> <s:textfield id="cgPrice" name="cgPrice" size="30"></s:textfield>
				</p>
			</div>
			<p class="ch-form-actions">
				<s:submit cssClass="ch-btn ch-btn-small" value="确认"></s:submit>
				<s:reset class="ch-btn ch-btn-small" value="重置"></s:reset>
			</p>
		</s:form>
	</div>
	<%@include file="/skins/jsp/loadJquery.jsp"%>
	<script type="text/javascript">
		var delCue = function(cttId,cgId){if(confirm("是否要删除此条记录！"))delCGood(cttId,cgId)},delCGood = function(cttId,cgId){window.location.href="<%=request.getContextPath()%>/contract/delCGood.action?cttId=" + cttId+"&cgId="+cgId};
		var anum = $("#cgNum").number("请输入正确数量！"),cgPrice = $("#cgPrice").price("请输入正确金额！");
	</script>
</body>
</html>